// home/city/city.js
import api from '../../utils/api.js';
import network from '../../utils/network.js';
import notice from '../../utils/notice.js';

Page({

    /**
     * 页面的初始数据
     */
    data: {
        list: []
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        network.getJson(api.dictType, {
            type: 'open_city'
        }).then(res => {
            this.setData({
                list: res.data
            })
        })
    },

    goBack() {
        wx.navigateBack();
    },

    selectCity(e) {
        let city = e.currentTarget.dataset.city;
        notice.postNotice("GetCity", {city});
        wx.navigateBack();
    }
})